

export const desc = {
    "name": "创建角色",
    "desc": "创建成功则通知客户端刷新角色列表",
    "params_type": "json",
    "params": [
        {
            "en_name": "characters_name",
            "cn_name": "角色名",
            "desc": "",
            "example": "张三"
        },
        {
            "en_name": "characters_type",
            "cn_name": "角色类型",
            "desc": "",
            "example": ""
        },
        {
            "en_name": "characters_color",
            "cn_name": "染色方案",
            "desc": "",
            "example": ""
        },
    ],
    "returns": [],
    "example": 'JGESDK:发送(3)'
}

// @ts-ignore
export async function execute(client_id, message_json) {
    let characters_name = message_json["characters_name"];
    let characters_type = message_json["characters_type"];
    let characters_color = message_json["characters_color"];
    let new_characters = await G.Characters.create_characters(client_id, _ClientUidData.get(client_id), _ClientUserNameData.get(client_id),
        characters_name, characters_type, characters_color);
    if (typeof new_characters !== "string") {
        //下发角色信息，通知客户端角色创建完毕
        await G.Characters.load_characters(client_id, _ClientUidData.get(client_id), _ClientUserNameData.get(client_id));
    }

}